home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / comm1 / intsdkss.lha / include / sys / fcntl.h < prev    next >
C/C++ Source or Header  |  1996-04-09  |  3KB  |  89 lines

  1. /*    @(#)fcntl.h 1.1 86/07/07 SMI; from UCB 5.1 85/05/30    */
  2. /*
  3.  * Copyright (c) 1983 Regents of the University of California.
  4.  * All rights reserved.  The Berkeley software License Agreement
  5.  * specifies the terms and conditions for redistribution.
  6.  */
  7.  
  8. #ifndef __FCNTL_HEADER__
  9. #define __FCNTL_HEADER__
  10.  
  11. /*
  12.  * Flag values accessible to open(2) and fcntl(2)
  13.  *  (The first three can only be set by open)
  14.  *
  15.  * AMIGA: edited to match MANX definitions
  16.  */
  17. #define O_RDONLY    0
  18. #define O_WRONLY    1
  19. #define O_RDWR        2
  20. #define O_NDELAY    FNDELAY /* Non-blocking I/O */
  21. #define O_APPEND    FAPPEND /* append (writes guaranteed at the end) */
  22. #define O_CREAT     FCREAT    /* open with file create */
  23. #define O_TRUNC     FTRUNC    /* open with truncation */
  24. #define O_EXCL        FEXCL    /* error on create if file exists */
  25.  
  26. /* flags for F_GETFL, F_SETFL-- needed by <sys/file.h> */
  27. #define FNDELAY     00004        /* non-blocking reads */
  28. #define FAPPEND     00010        /* append on each write */
  29. #define FCREAT        0x100        /* create if nonexistant */
  30. #define FTRUNC        0x200        /* truncate to zero length */
  31. #define FEXCL        0x400        /* error if already created */
  32. #define FASYNC        0x800        /* signal pgrp when data ready */
  33.  
  34. /* fcntl(2) requests */
  35. #define F_DUPFD 0    /* Duplicate fildes */
  36. #define F_GETFD 1    /* Get fildes flags */
  37. #define F_SETFD 2    /* Set fildes flags */
  38. #define F_GETFL 3    /* Get file flags */
  39. #define F_SETFL 4    /* Set file flags */
  40. #define F_GETOWN 5    /* Get owner */
  41. #define F_SETOWN 6    /* Set owner */
  42. #define F_GETLK  7    /* Get record-locking information */
  43. #define F_SETLK  8    /* Set or Clear a record-lock (Non-Blocking) */
  44. #define F_SETLKW 9    /* Set or Clear a record-lock (Blocking) */
  45.  
  46. /* access(2) requests */
  47. #define F_OK        0    /* does file exist */
  48. #define X_OK        1    /* is it executable by caller */
  49. #define W_OK        2    /* writable by caller */
  50. #define R_OK        4    /* readable by caller */
  51.  
  52. /* System-V record-locking options */
  53. /* lockf(2) requests */
  54. #define F_ULOCK 0    /* Unlock a previously locked region */
  55. #define F_LOCK    1    /* Lock a region for exclusive use */
  56. #define F_TLOCK 2    /* Test and lock a region for exclusive use */
  57. #define F_TEST    3    /* Test a region for other processes locks */
  58.  
  59. /* fcntl(2) flags (l_type field of flock structure) */
  60. #define F_RDLCK 1    /* read lock */
  61. #define F_WRLCK 2    /* write lock */
  62. #define F_UNLCK 3    /* remove lock(s) */
  63.  
  64.  
  65. /* file segment locking set data type - information passed to system by user */
  66. struct flock {
  67.     short    l_type;     /* F_RDLCK, F_WRLCK, or F_UNLCK */
  68.     short    l_whence;    /* flag to choose starting offset */
  69.     long    l_start;    /* relative offset, in bytes */
  70.     long    l_len;        /* length, in bytes; 0 means lock to EOF */
  71.     short    l_pid;        /* returned with F_GETLK */
  72.     short    l_xxx;        /* reserved for future use */
  73. };
  74.  
  75. extern int  open   (const char *, int, ...);
  76. extern int  creat  (const char *, int);
  77. extern int  read   (int, void *, unsigned int);
  78. extern int  write  (int, const void *, unsigned int);
  79. extern long lseek  (int, long, int);                /* for SAS/C */
  80. extern long tell   (int);                    /* for SAS/C */
  81. extern int  close  (int);
  82. extern int  unlink (const char *);                /* for SAS/C */
  83. extern int  iomode (int, int);                    /* for SAS/C */
  84. extern int  isatty (int);                    /* for SAS/C */
  85. extern int  mkdir  (const char *, int);
  86. extern int  rmdir  (const char *);
  87.  
  88. #endif /* !__FCNTL_HEADER__ */
  89.